***********************************************************************************
***	Replication file for:                                                     	***
*** Braun, S. T. and Stuhler, J. (2024). The Economic Consequences of 			***
***	Being Widowed by War: A Life-Cycle Perspective.	     						***
***																				***
***	Journal of Public Economics                                                 ***
***   							                                                ***
*** Script:		4-allbus-regression.do							   			 	***	
*** Purpose:	produces regression estimates based on ALLBUS					***
***																				***
*** Tables:		D1, D2, D3														***
***	Figures:	---																***
***********************************************************************************

* Preamble (unnecessary when executing run.do)
run "$widowsallbus/scripts/programs/_config.do"

************
* Code begins
************

********************************************************************************
*** Table D1: Impact of war widowhood on the importance of different life areas
********************************************************************************

** Sample: Females born 1906-1921 who married before 1945
use "$widowsallbus/processed/allbus1980_88_edit.dta", clear

keep if d_female == 1
keep if inrange(birth_year, 1906, 1921)
keep if d_married_b1945 == 1

foreach depvar in importance_family importance_job importance_leisure importance_friends importance_relatives importance_religion importance_politics{
	reg `depvar' d_spouse_died_WW2 i.years_schooling i.school_degree_father i.birth_year i.year_marriage1 i.interview_year, vce(robust)
	est store r_`depvar'	
	su `depvar' if d_spouse_died_WW2==0 & e(sample)==1
	estadd scalar controlmean=r(mean), replace
}

esttab r_importance_family r_importance_job r_importance_leisure r_importance_friends r_importance_relatives r_importance_religion r_importance_politics using"$widowsallbus/results/tables/table-D1.tex", keep(d_spouse_died_WW2) coeflabels(d_spouse_died_WW2 "War widow") cells(b(fmt(3)) se(fmt(3) par("(" ")"))) stats (controlmean N, fmt(%9.3f %9.0f) labels("Control mean" "N")) nomtitles nonum noobs collabel(none)  nostar fragment booktabs replace 


********************************************************************************
*** Table D2: Impact of war widowhood on work-related gender norms
********************************************************************************

foreach depvar in index_groles_work_v2 d_work_wife_harmschild d_women_notwork_nokids d_women_notwork_smallkids d_women_notwork_schkids {
	
	reg `depvar' d_spouse_died_WW2 i.years_schooling i.school_degree_father i.birth_year i.year_marriage1 i.interview_year, vce(robust)
	est store r_`depvar'	
	su `depvar' if d_spouse_died_WW2==0 & e(sample)==1
	estadd scalar controlmean=r(mean), replace

}

esttab r_index_groles_work_v2 r_d_work_wife_harmschild r_d_women_notwork_nokids r_d_women_notwork_smallkids r_d_women_notwork_schkids using"$widowsallbus/results/tables/table-D2.tex", keep(d_spouse_died_WW2) coeflabels(d_spouse_died_WW2 "War widow") cells(b(fmt(3)) se(fmt(3) par("(" ")"))) stats (controlmean N, fmt(%9.3f %9.0f) labels("Control mean" "N")) nomtitles nonum noobs collabel(none)  nostar fragment booktabs replace 


********************************************************************************
*** Table D3: Intergenerational spillovers on work-related gender norms
********************************************************************************

** Sample: Respondents born 1929-45 who did not lose their mother before 1945

use "$widowsallbus/processed/allbus1980_88_edit.dta", clear

keep if inrange(birth_year, 1929, 1945)
drop if death_mother_b1945 == 1


* Females
foreach depvar in index_groles_work_v2 d_work_wife_harmschild d_women_notwork_nokids d_women_notwork_smallkids d_women_notwork_schkids  {
	reg `depvar' death_father_WW2 i.birth_year i.years_schooling_father if d_female == 1, robust
	est store r_`depvar'	
	su `depvar' if d_spouse_died_WW2==0 & e(sample)==1
	estadd scalar controlmean=r(mean), replace
}

esttab r_index_groles_work_v2 r_d_work_wife_harmschild r_d_women_notwork_nokids r_d_women_notwork_smallkids r_d_women_notwork_schkids using"$widowsallbus/results/tables/table-D3-panelA.tex", keep(death_father_WW2) coeflabels(death_father_WW2 "Father's death") cells(b(fmt(3)) se(fmt(3) par("(" ")"))) stats (controlmean N, fmt(%9.3f %9.0f) labels("Control mean" "N")) nomtitles nonum noobs collabel(none) nostar fragment booktabs replace 

* Males
foreach depvar in index_groles_work_v2 d_work_wife_harmschild d_women_notwork_nokids d_women_notwork_smallkids d_women_notwork_schkids {
	reg `depvar' death_father_WW2 i.birth_year i.years_schooling_father if d_female == 0, robust
	est store r_`depvar'	
	su `depvar' if d_spouse_died_WW2==0 & e(sample)==1
	estadd scalar controlmean=r(mean), replace
}

esttab r_index_groles_work_v2 r_d_work_wife_harmschild r_d_women_notwork_nokids r_d_women_notwork_smallkids r_d_women_notwork_schkids using"$widowsallbus/results/tables/table-D3-panelB.tex", keep(death_father_WW2) coeflabels(death_father_WW2 "Father's death") cells(b(fmt(3)) se(fmt(3) par("(" ")"))) stats (controlmean N, fmt(%9.3f %9.0f) labels("Control mean" "N")) nomtitles nonum noobs collabel(none) nostar fragment booktabs replace 


*** EOF


